home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1995 March / PC Plus Super CD (Issue 101) (March 1995).iso / tclite / include / ordcltn.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-27  |  2.3 KB  |  65 lines

  1. #ifndef    ORDEREDCLTN_H
  2. #define    ORDEREDCLTN_H
  3.  
  4. #include "seqcltn.h"
  5. #include "arrayob.h"
  6.  
  7. extern const Class class_OrderedCltn;
  8.  
  9. class SortedCltn;
  10.  
  11. class OrderedCltn : public SeqCltn {
  12.     int endIndex;
  13.     ArrayOb contents;
  14.     Object* addAtIndex(int i, const Object& ob);
  15.     void errEmpty(const char* fn) const;
  16.     void errNotFound(const char* fn, const Object& ob) const;
  17.     Object* removeAtIndex(int i);
  18.     friend SortedCltn;
  19. public:
  20.     OrderedCltn(unsigned size =CLTN_DEFAULT_CAPACITY);
  21.     OrderedCltn(const OrderedCltn&);
  22.     bool operator!=(const OrderedCltn& a) const   { return !(*this==a); }
  23.     void operator=(const OrderedCltn&);
  24.     bool operator==(const OrderedCltn&) const;
  25.     Object*& operator[](int i) const {
  26.         if ((unsigned)i > endIndex) indexRangeErr();
  27.         return contents[i];
  28.     }
  29.     OrderedCltn operator&(const SeqCltn& cltn) const; // concatenation operator
  30.     void operator&=(const SeqCltn& cltn);
  31.     virtual Object* add(const Object&);
  32.     virtual Object* addAfter(const Object& ob, const Object& newob);
  33.     virtual Object* addAllLast(const OrderedCltn&);
  34.     virtual Object* addBefore(const Object& ob, const Object& newob);
  35.     virtual Collection& addContentsTo(Collection& cltn) const;
  36.     virtual Object* addLast(const Object& ob);
  37.     virtual Object* after(const Object&) const;
  38.     virtual Object*& at(int i) const;
  39.     virtual void atAllPut(const Object& ob);
  40.     virtual Object* before(const Object&) const;
  41.     virtual unsigned capacity() const;
  42.     virtual void deepenShallowCopy();
  43.     virtual Object* first() const;
  44.     virtual unsigned hash() const;
  45.     virtual int indexOf(const Object& ob) const;
  46.     virtual int indexOfSubCollection(const SeqCltn& cltn, int start=0) const;
  47.     virtual const Class* isA() const;
  48.     virtual bool isEmpty() const;
  49.     virtual bool isEqual(const Object&) const;
  50.     virtual Object* last() const;
  51.     virtual unsigned occurrencesOf(const Object&) const;
  52.     virtual void printOn(ostream& strm) const;
  53.     virtual Object* remove(const Object&);
  54.     virtual Object* removeId(const Object&);
  55.     virtual Object* removeLast();
  56.     virtual void replaceFrom(int start, int stop,
  57.                              const SeqCltn& replacement, int startAt =0);
  58.     virtual void reSize(unsigned newSize);
  59.     virtual unsigned size() const;
  60.     virtual void sort();
  61.     virtual const Class* species() const;
  62. };
  63.  
  64. #endif
  65.